package Demo2;

public class MyArray {
    //泛型方法
    public static <E> E getArray(E[] array, int pos) {
        if (pos >= 0 && pos < array.length) {
            return array[pos];
        } else {
            throw new IndexException("索引越界!!!");
        }
    }
}
